package com.lee.api.client;

import com.lee.common.model.AppResult;
import com.lee.common.model.ArticleReply;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@FeignClient(value = "reply-service", path = "/reply")
public interface ReplyClient {

    @PostMapping("/create")
    public AppResult create(HttpServletRequest request,
                            @RequestParam("articleId") Long articleId,
                            @RequestParam("content") String content);

    @GetMapping("/getReplies")
    public AppResult<List<ArticleReply>> getRepliesByArticleId (
            @RequestParam("articleId") Long articleId);

    List<ArticleReply> selectByArticleId(Long id);
}
